home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
clipper
/
cgwrka10.zip
/
APL.A
next >
Wrap
Text File
|
1994-02-24
|
45KB
|
1,289 lines
*****************************************************************
U S E O F L I B R A R Y cg_work 1.0
March 1994, Bostjan Debeljak
*****************************************************************
1. SHORT DESCRIPTION
This is the library for creating applications in Clipper with no programing.
It includes functions on database (query, insert, update, delete, etc), user
functions on database, user functions before and after functions on database,
help, multi table transparency on screen, user input control, etc.
User must call just two (2) commands from the library for all this functions.
Demo program is also with this library. For your immediate work and for
your estimation of this library I recommend you next steps:
- Compile demo program (command "rmake demo").
- Execute demo program and check library functionality.
- See teh demo source file ('demo.prg'). Ragarding its smallness you
will see the functionality of the library and its ease of use.
2. INTRODUCTION
Nowadays every user of PC need or use same data base. This is usually very
specific for each person.
This library is intended for users who need data base and know how to
program in Clipper and also for those who don't know anything about programing.
Purpose of this library is prototyping, but it can be also
used for complete applications. Applications create with use of this
library have all functionality needed for work with data base.
It is necessary to have Clipper compiler for creation of applications
with this library.
Syntax is very simple for use and doesn't demand programing skills.
Programer must only know how to make database (for example with DBU,
which already exists in Clipper).
Fast changes are possible without compiling.
Library includes all functions (system functions) necessary for
application on database. This functions are available in applications
without any programing:
- query;
- add;
- update;
- delete;
- line display;
- output;
- etc;
User can add his/her functions on database at the same level as are system
functions.
User define functions can be called before and after each of this system
functions on database.
Such functions can be for user define outputs (header,..), colors, controls,
etc. Programer must write this functions and include them in the application.
The library then take care for their execution at the right time.
Data from different tables can be transparently displayed on the screen at the
same time (which data belongs to some table isn't visible).
User define functions can be called also before window display. So the
screen can be completely user defined.
Two (or more) different records from same table can be displayed in one
window.
Messages for help can exist for whole window or for each field in the window.
Fields in screen have a lot of attributes, which can be changed by programer,
without recompiling or relinking of the application (display format, default
values, user controlled insertion in the fields, etc).
Programer must write all this attribute in an ascii file - specifications.
Only the list of the tables, fields from the tables which will be displayed
on the screen, their location on the screen and links between tables must
be in that file. Two functions (cg_init, cg_work) from the library, which
reads the specifications, must be called from the application.
So the whole application can be done in 15 minutes. This approach is
very useful for prototyping. There exist also a lot of other attributes
and possibilities with which complex application can be created. This
demands also some (but very little) programing.
3. PROCEEDINGS
A. Creation of tables and indexes (for example with DBU). For index creation
see item 6.4.
B. Creation of specifications (see item 6). Specifications for demo example
are in file "INP_DEMO". Next rules are enough for creation of basic
specifications:
- insert window name;
- insert names of all areas;
- insert data for areas: tables, fields and connections.
C. Creation of user application with library commands.
- insert absolute data base path in variable 'db_path' (see item 7.3).
- initialisation of library variables with command 'cg_init()'.
- execution of command 'cg_work', which allows all library
functionality.
This document describes all the functionality of the library . But just
items 5 and 6 are enough for the start. And also some points in this two
items are unnecessary for the start.
Demo is also included with this library and is a good help to show the use
of the library.
4. DICTIONARY
table - work area;
record - one line of data in one table in the database;
field - area in screen (in window) for display of one data (e.g. number,
string);
element - records from all tables currently displayed on screen;
programer - person, who use this library for creation of the applications;
user - person, who uses this applications.
Of course can programer and user be the same person.
5. LIBRARY COMMANDS
Programer can use in his/her applications some commands from library.
There are (just!!) four commands available:
5.1 cg_init
Initialize user functions and some variables. It must be called before
first 'cg_work' command. It should be placed at the beginning of the
applications.
Syntax:
cg_init()
Variable 'db_path' must be set before this command (see item 7.3).
5.2 cg_work
Windows, tables with their fields, attributes, etc are described in input
file - specifications.
This command search desired window name in specifications, read data and
displays window on screen. It also allows execution of system and user
functions.
Syntax:
cg_work("f_name", "w_name", l_x, u_y, r_x, b_y)
Parameters are:
f_name - input file name, specifications;
w_name - window name from specifications;
l_x - left x window coordinate;
u_y - upper y window coordinate;
r_x - right x window coordinate;
b_y - bottom y window coordinate.
If the window is bigger than the size of the screen or coordinate data
doesn't exists, there exist default data for window. This are:
0 - for left x coordinate;
0 - for upper y coordinate;
Maxcol() - for right x coordinate;
Maxrow()-1 - for bottom y coordinate;
5.3 next_el
This command searches for next element in tables. Return value is '.t.' if
element was found else value '.f.' is returned.
This command doesn't show the element.
Syntax:
next_el()
5.4 previous_el
This command searches for previous element in tables. Return value is '.t.' if
element was found else value '.f.' is returned.
This command doesn't show the element.
Syntax:
previous_el()
-------
Programer can use last two commands in user functions for searching next
or previous element without displaying it.
All errors and warnings are displayed in the bottom line on the screen. They are
shown for 5 sec. User can delete this line before 5 sec is over and
continue with work, by pressing any button.
Some commands which are part of Clipper library are already linked in this
library. This are:
error_msg()
Displays comment, given as parameter, in last row on the screen.
error_off()
Delete the bottom line on the screen.
rsvp()
Displays question, given as parameter, in the bottom line on the screen.
Possible answer is 'Y' or 'N'. Answer is returned by the command.
ListAsArray()
First parameter of this command is string, second one is delimiter. Command
returns array of strings which are between delimiters in the parameter
string. Example: "ab,cd,ef" -> command returns array of strings with size
3: [1]="ab; [2]="cd"; [3]="ef".
Program distinguishes between upper and lower letters.
6. SPECIFICATIONS
Commands in the library read data from input file - specifications.
Specifications can have data for one or more windows. Each window starts with
label "WINDOW" folloved by window name, which is used in command 'cg_work'.
Window can be just on the screen (n